﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LightSwitchApplication.UserCode
{
    class ServerJobFactory
    {
        ApplicationData ApplicationData;
        tbServerJob Job;

        public ServerJobFactory(ApplicationData ApplicationData)
        {
            this.ApplicationData = ApplicationData;
        }

        public void CreateJob(string Name)
        {
            Job = ApplicationData.tbServerJobSet.AddNew();
            Job.Name = Name;
        }

        public void AddParameter(string ParameterName, string ParameterValue)
        {
            tbServerJobParameter param = ApplicationData.tbServerJobParameterSet.AddNew();
            param.Name = ParameterName;
            param.Value = ParameterValue;
            param.tbServerJob = Job;
        }

        public void SaveJob()
        {
            ApplicationData.SaveChanges();
        }
    }
}
